import type { PageResult, ResponseBody } from "@/api/typing";
import { request } from "@/utils/request";
import type {
  DeleteParams,
  LocaleParams,
  QueryListResult,
  QueryPageParams,
  QueryPageResult,
} from "./typing";

/**列表查询国际化值 */
export const queryByList = () => {
  return request.get<null, ResponseBody<QueryListResult>>("/locale/list");
};

/**新增国际化值 */
export const add = (params: LocaleParams) => {
  return request.post<LocaleParams, ResponseBody>("/locale/add", params);
};

/**修改国际化值 */
export const update = (params: LocaleParams) => {
  return request.put<LocaleParams, ResponseBody>("/locale/update", params);
};

/**分页查询国际化值 */
export const queryByPage = (params: QueryPageParams) => {
  return request.get<
    QueryPageParams,
    ResponseBody<PageResult<QueryPageResult>>
  >("/locale/page", { params });
};

/**删除国际化值 */
export const del = (params: DeleteParams) => {
  return request.delete<DeleteParams, ResponseBody>("/locale/delete", {
    params,
  });
};
